<?

define('_CATEGORY_ORGANIC'      ,"O");
define('_CATEGORY_NONORGANIC'   ,"N");
define('_CATEGORY_MP2'          ,"M");

//connect to db and get all necessary data
//require("../misc.php");
$COracle = new oracleDb;
$COracle->init($_SESSION["ORCL"], 
               $_SESSION["OPASS"],
               $_SESSION["SID"],
               _NO_COMMENT);

$isDbg  = _IS_SILENT;

if ($COracle->connect()) {
	
	$thisMdl  = "PCH-ORDER";
	
	$srcDbHdr			  = "PCH_ORDER_HDR";
  $srcDbDtl       = "PCH_ORDER_DTL";
  $srcDbDtlSub    = "PCH_ORDER_SUB_DTL";
    
	$optPrivs = "";
  if($UID->getPrivs( $thisMdl, "VIEW_RIGHTS") > 0){
  	
  	$optPrivs .=	"  <td> ".formInputButton("<font size='5'>View</font>", // The label
    							                          "view",                       // var Name
    							                          "View",                       // var value
    							                          $entryBoxStyle)." </td>\n";   // var properties
  }
  if($UID->getPrivs( $thisMdl, "EDIT_RIGHTS") > 0){
  	
  	$optPrivs .=	"  <td> ".formInputButton("<font size='5'>Modify</font>", // The label
    							                          "modify",                       // var Name
    							                          "Modify",                       // var value
    							                          $entryBoxStyle)." </td>\n";     // var properties 
  }
  if($UID->getPrivs( $thisMdl, "APPROVED_RIGHTS") > 0){
  
  	$optPrivs	.=	"  <td> ".formInputButton("<font size='5'>Approve</font>", // The label
    							                          "approve",                       // var Name
    							                          "Approve",                       // var value
    							                          $entryBoxStyle)." </td>\n";      // var properties
  }
  if($UID->getPrivs( $thisMdl, "DELETE_RIGHTS") > 0){
  
  	$optPrivs	.=	"  <td> ".formInputButton("<font size='5'>Cancel</font>", // The label
    							                          "cancel",                       // var Name
    							                          "Cancel",                       // var value
    							                          $entryBoxStyle)." </td>\n";     // var properties
  }
  if($UID->getPrivs( $thisMdl, "DELETE_RIGHTS") > 0){			
  	
  	$optPrivs	.=	"  <td> ".formInputButton("<font size='5'>Delete</font>", // The label
    							                          "delete",                       // var Name
    							                          "Delete",                       // var value
    							                          $entryBoxStyle)." </td>\n";     // var properties
  }
  
  $jobId = $_POST["radioview"];
	
	if($_POST["transVariable"] != true){
	
  	echo  "<link rel=\"stylesheet\" type=\"text/css\" href=\"../myMenu.css\"/>\n".
  			  
  			  /**
          * This module js
          *
          */
  			  "<SCRIPT LANGUAGE=\"JavaScript\" SRC=\"javascript/misc.js\"></SCRIPT> \n".
  			  "<SCRIPT LANGUAGE=\"JavaScript\" SRC=\"javascript/ajax.js\"></SCRIPT> \n".
  			  
  	      "<form action=viewdboredit.php name='crtList' method=post>\n".
  				"<table border='1'>\n".
  				"<tr>\n".
  				"<input type='submit' value='back' name='back'>\n".
  			  $optPrivs.
  			  "<input type='hidden' name='radioview' value='".$_POST["radioview"]."'>\n".
  			  "<input type='hidden' name='selbox[]'  value='".$_POST["radioview"]."'>\n".
  				"</tr>\n".
  				"</table>\n".
  				"</form>\n";  
  
  }else{
    
    /**
    * The form about to generated
    * is a minimalistic form
    * featured with only Get or Cancel
    *
    * Where Get is to fetch all checked transaction
    *       Cancel is to cancel this process
    *
    */
    $CHtml = new CGHtml;
    $CJs   = new CGJavascript;
    
    $propCheckOut = $CJs->jsOnClick("return false;");
    
    echo  "<link rel=\"stylesheet\" type=\"text/css\" href=\"../myMenu.css\"/>\n".
    
          /**
          * This module js
          *
          */
  			  "<SCRIPT LANGUAGE=\"JavaScript\" SRC=\"javascript/misc.js\"></SCRIPT> \n".
  			  "<SCRIPT LANGUAGE=\"JavaScript\" SRC=\"javascript/ajax.js\"></SCRIPT> \n".
  			  
  				"<table border='1' align='right' class='dedeq'>\n".
  				  "<tr>\n".
  				  "<td> ".$CHtml->formSubmit("checkOut",
          				                     "checkOut",
          				                     $propCheckOut)." </td>\n".
  				  
  				  "</tr>\n".
  				"</table>\n".
  				  
  				"<form action=viewdboredit.php name='crtList' method=post>\n".
  				
  				$CHtml->formSubmit("back",
				                     "Back",
				                     $propBack).
				                     
				  $CHtml->formHidden("transVariable",
				                     $_POST["transVariable"],
				                     $propTransfer).          
  				"</form>\n";
  }
  
  require("views/view_html.php");       
}else{
	
	usrDie("Oracle connection Failed!");
	OUT();
}


?>